package com.example.forest.demos.web;

import com.alibaba.fastjson.JSONObject;
import com.dtflys.forest.annotation.BaseRequest;
import com.dtflys.forest.annotation.Body;
import com.dtflys.forest.annotation.Post;
import com.example.forest.interceptor.TqInterceptor;

@BaseRequest(
        baseURL = "${tqUrl}",    // 默认域名
        headers = {
                "Content-Type: application/x-www-form-urlencoded"
        },
        interceptor = {TqInterceptor.class}
)
public interface TqInterfaces {


    //获取access_token
    @Post("/")
    public JSONObject getAccessToken(@Body(value = "method",defaultValue = "jimi.oauth.token.get")String method,@Body("user_id")String userId, @Body("user_pwd_md5")String userPwdMd5, @Body(value = "expires_in",defaultValue = "7200")String expiresIn);

    //刷新access_token
    @Post("/")
    public JSONObject refreshToken(@Body(value = "method",defaultValue = "jimi.oauth.token.refresh")String method,@Body("access_token")String accessToken, @Body("refresh_token")String refreshToken, @Body(value = "expires_in",defaultValue = "7200")String expiresIn);

    // 根据账户，获取该账户下的所有IMEI信息
    @Post("/")
    public JSONObject getAccountImeiInfo(@Body(value = "method", defaultValue = "jimi.user.device.list") String method, @Body("access_token") String accessToken, @Body("target") String target);

    // 根据账户，获取该账户下所有IMEI的最新定位数据
    @Post("/")
    public JSONObject getAllDevicesLatestLocation(@Body(value = "method", defaultValue = "jimi.user.device.location.list") String method, @Body("access_token") String accessToken, @Body("target") String target, @Body(value = "map_type", defaultValue = "") String mapType);

    // 根据IMEI获取设备详细信息
    @Post("/")
    public JSONObject getDeviceDetails(@Body(value = "method", defaultValue = "jimi.open.device.getDetails") String method, @Body("access_token") String accessToken, @Body("imeis") String imeis);

    // 根据IMEI获取最新定位数据
    @Post("/")
    public JSONObject getLatestLocation(@Body(value = "method", defaultValue = "jimi.device.location.get") String method, @Body("access_token") String accessToken, @Body("imeis") String imeis, @Body(value = "map_type", defaultValue = "") String mapType);

    // 根据IMEI获取轨迹数据
    @Post("/")
    public JSONObject getTrackData(@Body(value = "method", defaultValue = "jimi.device.track.list") String method, @Body("access_token") String accessToken, @Body("imei") String imei, @Body("begin_time") String beginTime, @Body("end_time") String endTime, @Body(value = "map_type", defaultValue = "") String mapType);


}
